package cn.adelyn.blog.file.feign;

import cn.adelyn.blog.api.file.feign.PicFeignClient;
import cn.adelyn.blog.file.constant.MinioConstant;
import cn.adelyn.blog.file.service.FileService;
import cn.adelyn.common.core.response.ServerResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class PicFeignController implements PicFeignClient {

    @Autowired
    FileService fileService;

    @Override
    public ServerResponseEntity deletePic(List<Long> picIds) {
        for (Long picId : picIds) {
            fileService.deleteFile(MinioConstant.PIC_PATH_PREFIX + MinioConstant.PATH_SEPARATOR + picId, picId);
        }
        return ServerResponseEntity.success();
    }
}
